import 'package:flutter/material.dart';
import 'package:gold/base/config.dart';
import 'package:gold/utils/xfg_size.dart';
import 'package:gold/widgets/xfg_text.dart';

/// @description:
/// @author tangzhentao
/// @created at 22:08 2025/3/5

/// 状态集合
final List<String> recoverStatusList = [
  RecoverOrderStatus.all, RecoverOrderStatus.unPickUp, RecoverOrderStatus.unReceipt,
  RecoverOrderStatus.unVerify, RecoverOrderStatus.unConfirm, RecoverOrderStatus.done,RecoverOrderStatus.canceled
];

/// 获取状态描述
/// 0=待取件,1=待收件,2=待核件,3=待确认,4=已完成
String getRecoverOrderStatusString(String status) {
  if (status == RecoverOrderStatus.unPickUp) {
    return '待取件';
  } else if (status == RecoverOrderStatus.unReceipt) {
    return '待收件';
  } else if (status == RecoverOrderStatus.unVerify) {
    return '待核件';
  } else if (status == RecoverOrderStatus.unConfirm) {
    return '待确认';
  } else if (status == RecoverOrderStatus.done) {
    return '已完成';
  } else if (status == RecoverOrderStatus.canceled) {
    return '已取消';
  } else {
    return '全部';
  }
}

/// 获取金额描述Widget
List<Widget> getRecoverMoneyWidgets(double? money, Color color) {
  final list = (money?.toStringAsFixed(2)?? '0.00').split('.');
  return [
    XfgText('${list.first}.', fontSize: XfgSize().size18, color: color, bold: FontWeight.bold),
    XfgText(list.last, fontSize: XfgSize().size12, color: color, bold: FontWeight.bold)
  ];
}

/// 是否已核重
bool isVerified(String status) => status == RecoverOrderStatus.unConfirm || status == RecoverOrderStatus.done;

/// 是否已发货
bool isShipped(String status) => status == RecoverOrderStatus.done || status == RecoverOrderStatus.unVerify || status == RecoverOrderStatus.unReceipt || status == RecoverOrderStatus.unConfirm;

/// 是否已签收
bool isReceipted(String status) => status == RecoverOrderStatus.done || status == RecoverOrderStatus.unVerify || status == RecoverOrderStatus.unConfirm;

/// 是否已核件
bool isConfirmed(String status) => status == RecoverOrderStatus.done || status == RecoverOrderStatus.unConfirm;